﻿
using Colorful.UEditor;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;

namespace Colorful.Furniture.Controllers
{
    /// <summary>
    ///  百度文本编辑器控制器
    /// </summary>
    public class UEditorController : AbpController
    {
        private readonly UEditorService _uEditorService;

        public UEditorController(UEditorService uEditorService)
        {
            _uEditorService = uEditorService;
        }

        /// <summary>
        ///  编辑器
        /// </summary>
        /// <returns></returns>
        //如果是API，可以按MVC的方式特别指定一下API的URI
        [HttpGet, HttpPost]
        [Route("/Common/UEditor/Index")]
        public ContentResult Index()
        {
            var response = _uEditorService.UploadAndGetResponse(HttpContext);

            return Content(response.Result, response.ContentType);
        }
    }
}